Skip to content

feat: 닉네임 중복 확인 기능 추가 및 TermsDrawer에서 사용#37

Merged
dasosann merged 3 commits intomainfrom
feat/profile-image
Mar 11, 2026
Merged

feat: 닉네임 중복 확인 기능 추가 및 TermsDrawer에서 사용#37
dasosann merged 3 commits intomainfrom
feat/profile-image

Conversation

@dasosann
Copy link
Copy Markdown
Contributor

No description provided.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

닉네임 중복 확인 기능 추가 및 약관 동의 플로우 개선

✨ Enhancement

Grey Divider

Walkthroughs

Description
• 닉네임 중복 확인 API 호출 커스텀 훅 추가
• TermsDrawer에서 약관 동의 전 닉네임 중복 검증
• 다양한 API 응답 형식 지원하는 파서 구현
Diagram
flowchart LR
  A["TermsDrawer 클릭"] -->|닉네임 검증| B["useNicknameAvailability"]
  B -->|API 요청| C["닉네임 중복 확인 API"]
  C -->|응답 파싱| D["parseNicknameAvailability"]
  D -->|사용 가능| E["약관 동의 모달 열기"]
  D -->|중복| F["사용자 알림"]
Loading

Grey Divider

File Changes

1. hooks/useNicknameAvailability.ts ✨ Enhancement +61/-0

닉네임 중복 확인 커스텀 훅 구현

• 닉네임 중복 확인 API 호출 커스텀 훅 신규 생성
• 다양한 응답 형식 지원하는 파서 함수 구현
• React Query의 useMutation 활용한 비동기 처리
• 재시도 없이 단일 요청으로 처리하도록 설정

hooks/useNicknameAvailability.ts


2. app/profile-image/_components/TermsDrawer.tsx ✨ Enhancement +21/-2

약관 동의 전 닉네임 중복 검증 로직 추가

useNicknameAvailability 훅 임포트 및 초기화
• 약관 동의 버튼 클릭 시 닉네임 중복 검증 로직 추가
• 중복 닉네임 시 모달 열기 방지 및 사용자 알림
• 에러 처리 및 사용자 피드백 메시지 추가

app/profile-image/_components/TermsDrawer.tsx


Grey Divider

Qodo Logo


✨ Describe tool usage guide:

Overview:
The describe tool scans the PR code changes, and generates a description for the PR - title, type, summary, walkthrough and labels. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

When commenting, to edit configurations related to the describe tool (pr_description section), use the following template:

/describe --pr_description.some_config1=... --pr_description.some_config2=...

With a configuration file, use the following template:

[pr_description]
some_config1=...
some_config2=...
Enabling\disabling automation
  • When you first install the app, the default mode for the describe tool is:
pr_commands = ["/describe", ...]

meaning the describe tool will run automatically on every PR.

  • Markers are an alternative way to control the generated description, to give maximal control to the user. If you set:
pr_commands = ["/describe --pr_description.use_description_markers=true", ...]

the tool will replace every marker of the form pr_agent:marker_name in the PR description with the relevant content, where marker_name is one of the following:

  • type: the PR type.
  • summary: the PR summary.
  • walkthrough: the PR walkthrough.
  • diagram: the PR sequence diagram (if enabled).

Note that when markers are enabled, if the original PR description does not contain any markers, the tool will not alter the description at all.

Custom labels

The default labels of the describe tool are quite generic: [Bug fix, Tests, Enhancement, Documentation, Other].

If you specify custom labels in the repo's labels page or via configuration file, you can get tailored labels for your use cases.
Examples for custom labels:

  • Main topic:performance - pr_agent:The main topic of this PR is performance
  • New endpoint - pr_agent:A new endpoint was added in this PR
  • SQL query - pr_agent:A new SQL query was added in this PR
  • Dockerfile changes - pr_agent:The PR contains changes in the Dockerfile
  • ...

The list above is eclectic, and aims to give an idea of different possibilities. Define custom labels that are relevant for your repo and use cases.
Note that Labels are not mutually exclusive, so you can add multiple label categories.
Make sure to provide proper title, and a detailed and well-phrased description for each label, so the tool will know when to suggest it.

Inline File Walkthrough 💎

For enhanced user experience, the describe tool can add file summaries directly to the "Files changed" tab in the PR page.
This will enable you to quickly understand the changes in each file, while reviewing the code changes (diffs).

To enable inline file summary, set pr_description.inline_file_summary in the configuration file, possible values are:

  • 'table': File changes walkthrough table will be displayed on the top of the "Files changed" tab, in addition to the "Conversation" tab.
  • true: A collapsable file comment with changes title and a changes summary for each file in the PR.
  • false (default): File changes walkthrough will be added only to the "Conversation" tab.
Utilizing extra instructions

The describe tool can be configured with extra instructions, to guide the model to a feedback tailored to the needs of your project.

Be specific, clear, and concise in the instructions. With extra instructions, you are the prompter. Notice that the general structure of the description is fixed, and cannot be changed. Extra instructions can change the content or style of each sub-section of the PR description.

Examples for extra instructions:

[pr_description]
extra_instructions="""- The PR title should be in the format: '<PR type>: <title>'
- The title should be short and concise (up to 10 words)
- ...
"""

Use triple quotes to write multi-line instructions. Use bullet points to make the instructions more readable.

More PR-Agent commands

To invoke the PR-Agent, add a comment using one of the following commands:

  • /review: Request a review of your Pull Request.
  • /describe: Update the PR title and description based on the contents of the PR.
  • /improve [--extended]: Suggest code improvements. Extended mode provides a higher quality feedback.
  • /ask <QUESTION>: Ask a question about the PR.
  • /update_changelog: Update the changelog based on the PR's contents.
  • /help_docs <QUESTION>: Given a path to documentation (either for this repository or for a given one), ask a question.
  • /add_docs 💎: Generate docstring for new components introduced in the PR.
  • /generate_labels 💎: Generate labels for the PR based on the PR's contents.
  • /analyze 💎: Automatically analyzes the PR, and presents changes walkthrough for each component.

See the tools guide for more details.
To list the possible configuration parameters, add a /config comment.

See the describe usage page for a comprehensive guide on using this tool.

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review bot commented Mar 10, 2026

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Nickname trim mismatch🐞 Bug ✓ Correctness
Description
TermsDrawer checks availability with a trimmed nickname but submits the raw nickname string, so a
nickname with leading/trailing spaces can pass the check for the trimmed value yet be submitted as a
different value (or be server-trimmed into a duplicate). This can cause signup failures or allow
unintended “distinct” nicknames that only differ by whitespace.
Code

app/profile-image/_components/TermsDrawer.tsx[R154-158]

+          const nickname = (profile.nickname || "").trim();
+
+          try {
+            const isAvailable = await checkNicknameAvailability(nickname);
+
Evidence
The new code trims the nickname for the availability API call, but the signup payload still uses the
untrimmed profile.nickname. The start button enablement also uses trim(), so whitespace-padded
nicknames can reach this flow and trigger the mismatch.

app/profile-image/_components/TermsDrawer.tsx[149-171]
app/profile-image/_components/TermsDrawer.tsx[96-113]
app/profile-image/_components/ScreenProfileImage.tsx[39-42]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`TermsDrawer` trims `profile.nickname` for the availability check, but submits `profile.nickname` untrimmed. This can let whitespace-padded nicknames pass the check for a different canonical value and then submit a different string.
## Issue Context
The start button is enabled based on `nickname.trim().length`, so users can proceed with whitespace-padded nicknames.
## Fix Focus Areas
- app/profile-image/_components/TermsDrawer.tsx[96-129]
- app/profile-image/_components/TermsDrawer.tsx[154-165]
- (optional) app/profile-image/_components/ScreenProfileImage.tsx[23-29]
## Suggested change
- Use `const normalizedNickname = (profile.nickname || &amp;amp;amp;quot;&amp;amp;amp;quot;).trim();`
- Pass `normalizedNickname` both to `checkNicknameAvailability()` and into `submitData.nickname`.
- Optionally trim on `updateProfile({ nickname: val.trimStart()? })` depending on desired UX, but at minimum trim on submit.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Concurrent nickname checks 🐞 Bug ⛯ Reliability
Description
The trigger onClick fires an async availability request without guarding against repeated clicks
while the request is in-flight, allowing multiple concurrent GETs. This can waste API calls and
create inconsistent UX (e.g., multiple alerts, or an error alert from one request while another
succeeds and opens the drawer).
Code

app/profile-image/_components/TermsDrawer.tsx[R151-171]

+        onClick: async (e: React.MouseEvent<HTMLElement>) => {
       children.props.onClick?.(e);
-          setIsOpen(true);
+
+          const nickname = (profile.nickname || "").trim();
+
+          try {
+            const isAvailable = await checkNicknameAvailability(nickname);
+
+            if (!isAvailable) {
+              alert("중복된 닉네임입니다. 다른 닉네임을 입력해 주세요.");
+              return;
+            }
+
+            setIsOpen(true);
+          } catch (error) {
+            console.error("Failed to check nickname availability:", error);
+            alert(
+              "닉네임 중복 확인에 실패했습니다. 잠시 후 다시 시도해 주세요.",
+            );
+          }
     },
Evidence
The click handler always calls checkNicknameAvailability and has no early-return based on a
pending state. The hook is a plain useMutation, and the component does not consume any pending
flag to disable/ignore subsequent clicks during the request.

app/profile-image/_components/TermsDrawer.tsx[149-171]
hooks/useNicknameAvailability.ts[56-61]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Users can click the TermsDrawer trigger multiple times while nickname availability is being checked, causing concurrent requests and inconsistent alerts/open state.
## Issue Context
The current `onClick` handler always runs the async check; there is no in-flight guard.
## Fix Focus Areas
- app/profile-image/_components/TermsDrawer.tsx[149-173]
- hooks/useNicknameAvailability.ts[56-61]
## Suggested change
- In `TermsDrawer`, destructure `isPending` from `useNicknameAvailability()` and add:
- `if (isCheckingNickname) return;` at the start of onClick
- and/or pass `disabled={disabled || isCheckingNickname}` into the trigger element (if it is a button)
- Optionally render a spinner or change button text while checking.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자 프로필 설정 과정에서 닉네임 중복을 방지하기 위한 기능을 도입합니다. 새로운 닉네임 중복 확인 훅을 개발하고, 이를 TermsDrawer 컴포넌트에 통합하여 사용자가 약관 동의 단계로 넘어가기 전에 닉네임의 유효성을 검사하도록 함으로써, 데이터 무결성을 강화하고 사용자 경험을 개선합니다.

Highlights

  • 닉네임 중복 확인 기능 추가: 새로운 useNicknameAvailability 훅이 추가되어 사용자 닉네임의 중복 여부를 확인할 수 있게 되었습니다.
  • TermsDrawer에 닉네임 유효성 검사 통합: TermsDrawer 컴포넌트가 열리기 전에 사용자가 입력한 닉네임의 중복 여부를 확인하는 로직이 추가되었습니다. 중복된 닉네임일 경우 사용자에게 알림을 표시하고 진행을 막습니다.
  • 닉네임 중복 확인 오류 처리: 닉네임 중복 확인 API 호출 실패 시 사용자에게 오류 메시지를 표시하는 예외 처리 로직이 구현되었습니다.
Changelog
  • app/profile-image/_components/TermsDrawer.tsx
    • useNicknameAvailability 훅을 임포트했습니다.
    • 닉네임 중복 확인을 위한 checkNicknameAvailability 뮤테이션을 사용하도록 변경했습니다.
    • 자식 요소의 onClick 핸들러에 닉네임 중복 확인 로직을 추가하여, 중복된 닉네임일 경우 알림을 표시하고 드로어가 열리지 않도록 했습니다.
    • 닉네임 중복 확인 실패 시 오류를 처리하는 로직을 추가했습니다.
  • hooks/useNicknameAvailability.ts
    • 닉네임 중복 확인을 위한 useNicknameAvailability 커스텀 훅을 새로 추가했습니다.
    • API 응답을 파싱하여 닉네임 사용 가능 여부를 반환하는 parseNicknameAvailability 함수를 정의했습니다.
    • /api/auth/signup/nickname/availability 엔드포인트로 GET 요청을 보내 닉네임 중복을 확인하는 checkNicknameAvailability 함수를 구현했습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a nickname availability check feature, introducing a new useNicknameAvailability hook and integrating it into the TermsDrawer component. The TermsDrawer now performs an asynchronous nickname availability check before opening, alerting the user if the nickname is unavailable or if an error occurs. A review comment suggests an improvement to add client-side validation for empty nicknames within the TermsDrawer component to prevent unnecessary API calls to the nickname availability endpoint.

Comment on lines +154 to +161
const nickname = (profile.nickname || "").trim();

try {
const isAvailable = await checkNicknameAvailability(nickname);

if (!isAvailable) {
alert("중복된 닉네임입니다. 다른 닉네임을 입력해 주세요.");
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

닉네임 중복 확인 전에 빈 문자열에 대한 유효성 검사가 필요합니다. 현재 구현에서는 profile.nickname이 비어있을 경우 빈 문자열을 checkNicknameAvailability 함수에 전달하게 됩니다. 이는 불필요한 API 호출을 유발할 수 있습니다. API 호출 전에 클라이언트 측에서 빈 닉네임을 검증하는 것이 좋습니다.

            const nickname = (profile.nickname || "").trim();

            if (!nickname) {
              alert("닉네임을 입력해 주세요.");
              return;
            }

            try {
              const isAvailable = await checkNicknameAvailability(nickname);

              if (!isAvailable) {
                alert("중복된 닉네임입니다. 다른 닉네임을 입력해 주세요.");
                return;
              }

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

반영

@dasosann dasosann merged commit c863940 into main Mar 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant